package com.industrial.app.controller.formal;


import com.industrial.app.domain.formal.BizIndustrialElectricityConsumptionFormal;
import com.industrial.app.service.IBizIndustrialElectricityConsumptionFormalService;
import com.industrial.common.core.utils.poi.ExcelUtil;
import com.industrial.common.core.web.controller.BaseController;
import com.industrial.common.core.web.domain.AjaxResult;
import com.industrial.common.core.web.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;


/**
 * 工业用电量正式(新)Controller
 *
 * @author SangGuangCan
 * @date 2024-01-22
 */
@RestController
@RequestMapping("/biz/consumption/new/formal")
public class BizIndustrialElectricityConsumptionFormalController extends BaseController
{
    @Autowired
    private IBizIndustrialElectricityConsumptionFormalService bizIndustrialElectricityConsumptionFormalService;

    /**
     * 查询工业用电量正式(新)列表
     */
//    @PreAuthorize("@ss.hasPermi('biz:formal:list')")
    @GetMapping("/list")
    public TableDataInfo list(BizIndustrialElectricityConsumptionFormal bizIndustrialElectricityConsumptionFormal)
    {
        startPage();
        List<BizIndustrialElectricityConsumptionFormal> list = bizIndustrialElectricityConsumptionFormalService.selectBizIndustrialElectricityConsumptionFormalList(bizIndustrialElectricityConsumptionFormal);
        return getDataTable(list);
    }

    /**
     * 导出工业用电量正式(新)列表
     */
//    @PreAuthorize("@ss.hasPermi('biz:formal:export')")
//    @Log(title = "工业用电量正式(新)", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BizIndustrialElectricityConsumptionFormal bizIndustrialElectricityConsumptionFormal)
    {
        List<BizIndustrialElectricityConsumptionFormal> list = bizIndustrialElectricityConsumptionFormalService.selectBizIndustrialElectricityConsumptionFormalList(bizIndustrialElectricityConsumptionFormal);
        ExcelUtil<BizIndustrialElectricityConsumptionFormal> util = new ExcelUtil<BizIndustrialElectricityConsumptionFormal>(BizIndustrialElectricityConsumptionFormal.class);
        util.exportExcel(response, list, "工业用电量正式(新)数据");
    }

    /**
     * 获取工业用电量正式(新)详细信息
     */
//    @PreAuthorize("@ss.hasPermi('biz:formal:query')")
    @GetMapping(value = "/{baseId}")
    public AjaxResult getInfo(@PathVariable("baseId") String baseId)
    {
        return success(bizIndustrialElectricityConsumptionFormalService.selectBizIndustrialElectricityConsumptionFormalByBaseId(baseId));
    }

    /**
     * 新增工业用电量正式(新)
     */
//    @PreAuthorize("@ss.hasPermi('biz:formal:add')")
//    @Log(title = "工业用电量正式(新)", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BizIndustrialElectricityConsumptionFormal bizIndustrialElectricityConsumptionFormal)
    {
        return toAjax(bizIndustrialElectricityConsumptionFormalService.insertBizIndustrialElectricityConsumptionFormal(bizIndustrialElectricityConsumptionFormal));
    }

    /**
     * 修改工业用电量正式(新)
     */
//    @PreAuthorize("@ss.hasPermi('biz:formal:edit')")
//    @Log(title = "工业用电量正式(新)", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BizIndustrialElectricityConsumptionFormal bizIndustrialElectricityConsumptionFormal)
    {
        return toAjax(bizIndustrialElectricityConsumptionFormalService.updateBizIndustrialElectricityConsumptionFormal(bizIndustrialElectricityConsumptionFormal));
    }

    /**
     * 删除工业用电量正式(新)
     */
//    @PreAuthorize("@ss.hasPermi('biz:formal:remove')")
//    @Log(title = "工业用电量正式(新)", businessType = BusinessType.DELETE)
    @DeleteMapping("/{baseIds}")
    public AjaxResult remove(@PathVariable String[] baseIds)
    {
        return toAjax(bizIndustrialElectricityConsumptionFormalService.deleteBizIndustrialElectricityConsumptionFormalByBaseIds(baseIds));
    }

    @GetMapping("/queryRq")
    public AjaxResult queryRq(){
        return bizIndustrialElectricityConsumptionFormalService.queryRq();
    }
}
